package eg.ci.mvn.service.api.constant;


import eg.ci.mvn.service.api.dict.DictItemBean;
import eg.ci.mvn.service.api.dict.IDictItem;
import lombok.Getter;

/**
 * 人工减免类型标志 0-无减免 1-时长减免 2-金额减免
 * @author dev
 */
@Getter
public enum ReducingTypeEnum implements IDictItem {
    /** 无减免 */
    NON_REDUCING("nonReducing","无减免", "0"),
    /** 时长减免 */
    TIME_REDUCING("timeReducing","时长减免", "1"),
    /** 金额减免 */
    AMT_REDUCING("amtReducing","金额减免","2"),

    /** 未知 */
    UNKNOWN("unknown", "未知", "-1");

    /** 字典枚举目录 */
    private final static String CATEGORY = "ReducingTypeEnum";
    /** 字典枚举目录 LABEL */
    private final static String CATEGORY_LABEL = "人工减免类型标志";

    /** 构造 */
    ReducingTypeEnum(String item, String itemLabel, String itemValue) {
        // 放入到内存
        putDictItem(DictItemBean.builder()
                .category(CATEGORY)
                .categoryLabel(CATEGORY_LABEL)
                .item(item)
                .itemLabel(itemLabel)
                .itemValue(itemValue)
                .build());
    }

    public static String getEnumItemLabel(final String itemValue) {
        return IDictItem.getEnumItemLabel(ReducingTypeEnum.class, itemValue, UNKNOWN.itemLabel() + "(" + itemValue+ ")");
    }

    public static ReducingTypeEnum getEnumAtItemValue(String itemValue) {
        return IDictItem.getEnum(ReducingTypeEnum.class, itemValue, UNKNOWN);
    }

}
